
package x.trident.core.micro.gateway.config;

import x.trident.core.micro.gateway.core.filters.AddAuthHeaderFilter;
import x.trident.core.micro.gateway.core.filters.RequestNoFilter;
import x.trident.core.micro.gateway.core.filters.factory.AuthJwtTokenGatewayFilterFactory;
import x.trident.core.micro.gateway.core.filters.factory.PermissionGatewayFilterFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 过滤器的配置
 *
 * @author Seven
 * @date 2017-11-08-下午3:23
 */
@Configuration
public class FilterConfig {

    /**
     * 请求号header过滤器
     *
     * @author Seven
     * @date 2019/5/12 14:47
     */
    @Bean
    public RequestNoFilter requestNoFilter() {
        return new RequestNoFilter();
    }

    /**
     * 添加auth header过滤器
     *
     * @author Seven
     * @date 2019/5/12 14:47
     */
    @Bean
    public AddAuthHeaderFilter authHeaderFilter() {
        return new AddAuthHeaderFilter();
    }

    /**
     * token校验过滤器
     *
     * @author Seven
     * @date 2019/5/12 14:47
     */
    @Bean
    public AuthJwtTokenGatewayFilterFactory authJwtTokenGatewayFilterFactory() {
        return new AuthJwtTokenGatewayFilterFactory();
    }

    /**
     * 权限资源校验过滤器
     *
     * @author Seven
     * @date 2019/5/12 14:47
     */
    @Bean
    public PermissionGatewayFilterFactory permissionGatewayFilterFactory() {
        return new PermissionGatewayFilterFactory();
    }

}
